<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:pe="http://primefaces.org/ui/extensions">


    <ui:define name="content">


        <h:panelGroup rendered="true" >
            <h:form>
                <p:panel id="panelPrint" header="Investigation Month End Detail">
                    <f:facet name="header" >
                        <p:outputLabel value="Investigation Month End Detail"/>
                        <p:commandButton value="Refresh" ajax="false"  styleClass="noPrintButton" style="float: right;" />

                        <p:commandButton ajax="false" value="Print"  styleClass="noPrintButton" style="float: right;" >
                            <p:printer target="panelPrint" />
                        </p:commandButton>

                        <p:commandButton value="Excel" ajax="false" style="float: right;">
                            <pe:exporter type="xlsx" fileName="Investigation Month End Summary" facetBackground="#AAFFBB"   datasetPadding="4"
                                         target="tbl" subTable="true"/>
                        </p:commandButton>

                        <p:panelGrid columns="4" style="min-width: 100%;">
                            <h:outputLabel value="From Date"/>
                            <p:calendar id="frmDate" value="#{investigationMonthSummeryController.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" >

                            </p:calendar>

                            <h:outputLabel value="To Date"/>
                            <p:calendar id="toDate" value="#{investigationMonthSummeryController.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" >
                            </p:calendar>
                        </p:panelGrid>
                    </f:facet>

                    <p:dataTable id="tbl" value="#{investigationMonthSummeryController.itemDetails}" var="c" >

                     
                            

                            <p:subTable id="tbl" value="#{c.billItems}" var="bc">
                               
                                <f:facet name="header">
                                    <h:outputLabel style="font-weight: bold;" value="#{c.investigation.name}"/>
                                </f:facet>
                                <p:column headerText="Code">
                                    <h:outputLabel value="#{bc.bill.insId}"/>
                                </p:column>

                                <p:column headerText="Billed Date">
                                    <h:outputLabel value="#{bc.createdAt}">
                                        <f:convertDateTime pattern="dd MM yyyy"/>
                                    </h:outputLabel>
                                </p:column>

                                <p:column headerText="Patient Name">
                                    <h:outputLabel value="#{bc.bill.patient.person.name}"/>
                                </p:column>

                            </p:subTable>




                    </p:dataTable>




                </p:panel>        
            </h:form>
        </h:panelGroup>
    </ui:define>

</ui:composition>
